#ifndef _COPTIONBOX_H_
#define _COPTIONBOX_H_

#include <buola/gui/cwindow.h>
#include <buola/widgets/ccheckwidget.h>

namespace buola { namespace gui {

///\addtogroup widgets
///@{

/////////////////////////////////////////////////////////////////////////////

/// option box

///
///
///
/////////////////////////////////////////////////////////////////////////////

class COptionBox : public CCheckWidget
{
public:
///! \name constructor and destructor
//@{
    COptionBox();
    virtual ~COptionBox();
//@}

//! \name properties
//@{
    virtual void GetPropertyNames(std::vector<std::string> &pNames);
    virtual void SetProperty(const std::string &p,const UAny&);
//@}

private:
//! \name event handling
//@{
    virtual void OnExpose(const CExposeEvent &pE);
    virtual void OnButtonDown(const CMouseEvent &pE);
    virtual void OnButtonUp(const CMouseEvent &pE);
    virtual void OnFocusIn(const CFocusEvent &pE);
    virtual void OnFocusOut(const CFocusEvent &pE);
    virtual void OnChar(const CKeyEvent &pE);
    virtual void OnKeyDown(const CKeyEvent &pE);
    virtual void OnSize(const CGeometryEvent &pE);
    virtual void OnStyleChanged(TStyle);

    virtual void OnCWChecked();
//@}

public:
//! \name public interface
//@{
    //! sets the group for this option box
    void SetGroup(int);

    //! sets the caption to display for the box
    void SetCaption(const std::wstring &pCaption);

    //! returns the caption to display for the box
    const std::wstring &GetCaption()    {   return mCaption;    }
//@}

private:
//! \name internal functions
//@{
    void NotifyChecked(COptionBox*);
//@}

protected:
    bool mPressed;

    int mGroup;
    std::wstring mCaption;
    
    static std::vector<COptionBox*> mOptionBoxes;
};

///@}

/*namespace gui*/ } /*namespace buola*/ }

#endif
